'use strict';

module.exports = app => {
  const { DataTypes, BIGINT, DATE } = app.Sequelize;

  const Dirinsmsg = app.model.define('dirinsmsg', {
    id: { type: BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true },
    content: {
      type: DataTypes.CHAR(120),
      allowNull: false
    },
    dir_id: {
      type: DataTypes.INTEGER,
      allowNull: false
    },
    ins_id: {
      type: DataTypes.INTEGER,
      allowNull: false
    },
  }, {
    tableName: 't_dir_ins_msg'
  });
  Dirinsmsg.associate = function () {
    app.model.Dirinsmsg.belongsTo(app.model.Topic, {
      foreignKey: 'topic_id',
      as: 'topic'
    })
  }
  return Dirinsmsg;
};